package com.xudu.templatebackend.controller;

import com.xudu.templatebackend.common.BaseResponse;
import com.xudu.templatebackend.common.ResultUtils;
import com.xudu.templatebackend.exception.ErrorCode;
import com.xudu.templatebackend.exception.ThrowUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/")
public class MainController {

    /**
     * 健康检查
     */
    @GetMapping("/health")
    public BaseResponse<String> health() {
        class user {
            public String name = "xudu";
            public int age = 18;
        }
        user s = new user();

        ThrowUtils.throwIf(s == null, ErrorCode.SYSTEM_ERROR, "系统异常");
        return ResultUtils.success("ok");
    }
}